package com.hg.chapter931;

import com.hg.chapter931.message.Msg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.jms.core.JmsTemplate;

//消息发送及目的地
@SpringBootApplication
public class Chapter931Application implements CommandLineRunner {

    @Autowired
    JmsTemplate jmsTemplate;

    public static void main(String[] args) {
        SpringApplication.run(Chapter931Application.class, args);
    }

    //程序启动后执行的代码
	//发送的目的地
    @Override
    public void run(String... args) throws Exception {
        jmsTemplate.send("my-destination", new Msg("Hello"));
    }
}
